// 用户编写的头文件
#include "G4ExtensionActionInitialization.hh"
#include "G4ExtensionPrimaryGeneratorAction.hh"
#include "G4ExtensionSteppingAction.hh"
#include "G4ExtensionEventAction.hh"
#include "G4ExtensionRunAction.hh"

void G4ExtensionActionInitialization::BuildForMaster() const{

    G4ExtensionRunAction* runAction = new G4ExtensionRunAction;
    SetUserAction(runAction);
}

void G4ExtensionActionInitialization::Build() const{

    // 将粒子发射的行为配置到runmanager中
    SetUserAction(new G4ExtensionPrimaryGeneratorAction);

    // 将run行为配置到runmanager中
    G4ExtensionRunAction* runAction = new G4ExtensionRunAction;
    SetUserAction(runAction);

    // 将event行为配置到runmanager中
    G4ExtensionEventAction* eventAction = new G4ExtensionEventAction(runAction);  
    SetUserAction(eventAction);

    // 将step行为配置到runmanager中
    G4ExtensionSteppingAction* steppingAction = new G4ExtensionSteppingAction(eventAction);
    SetUserAction(steppingAction);
    
}